#!/opt/local/bin/python
import sys

for l in sys.stdin:
    l = l.strip()
    p = l.split()
    uid = p[0]
    itemid = p[1]
    rating = int(p[2])

    if rating == 1 or rating == -1:
        print itemid, uid , rating


